
#ifndef __EVENTLOOPTHREADPOOL_H__
#define __EVENTLOOPTHREADPOOL_H__
#include <iostream>
#include <vector>
#include <memory>

using std::vector;
using std::unique_ptr;

class EventLoop;
class EventLoopThread;
class EventLoopThreadPool //管理subReactor 多个事件循环
{
public:
    EventLoopThreadPool(EventLoop *mainLoop, size_t threadNum);
    ~EventLoopThreadPool();

    void start();
    EventLoop *getNextLoop(); //获取下一个subReactor
private:
    EventLoop *_mainLoop;
    size_t _IOthreadNum;
    vector<unique_ptr<EventLoopThread>> _subLoop;
    vector<EventLoop*> _loops;
    size_t _next; //下一个subReactor的索引
    bool _started; //是否已经启动

};


#endif